package com.api.shopapi.mapper;

import com.api.shopapi.entity.MedicationSchedulingMorning;
import com.api.shopapi.entity.dto.MedicationSchedulingMorningDTO;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface MedicationSchedulingMorningMapper {

    @Insert("insert into  medication_scheduling_morning " +
            "(MedicationSchedulingMorningCode,MedicationSchedulingCode) " +
            "values (#{medicationSchedulingMorning.MedicationSchedulingMorningCode} ,#{medicationSchedulingMorning.medicationSchedulingCode} )")
    int insert(@Param("medicationSchedulingMorning") MedicationSchedulingMorning medicationSchedulingMorning);

    @Update("update medication_scheduling_morning set MedicationSchedulingCode=#{medicationSchedulingMorning.MedicationSchedulingCode} where MedicationSchedulingMorningCode=#{medicationSchedulingMorning.MedicationSchedulingMorningCode}   ")
    int updateByMedicationSchedulingMorningCode(@Param("medicationSchedulingMorning") MedicationSchedulingMorning medicationSchedulingMorning);

    @Delete("delete from medication_scheduling_morning where MedicationSchedulingMorningCode=#{medicationSchedulingMorningCode} ")
    int deleteByMedicationSchedulingMorningCode(@Param("medicationSchedulingMorningCode")String medicationSchedulingMorningCode);

    @Select("select * from medication_scheduling_morning where MedicationSchedulingMorningCode=#{medicationSchedulingMorningCode} limit 1")
    MedicationSchedulingMorning getByMedicationSchedulingMorningCode(@Param("medicationSchedulingMorningCode")String medicationSchedulingMorningCode);

    @Select("select * from medication_scheduling_morning where medicationSchedulingCode=#{medicationSchedulingCode} limit 1")
    MedicationSchedulingMorningDTO getByMedicationSchedulingCode(@Param("medicationSchedulingCode") String medicationSchedulingCode);
}
